package com.example.littleSpider.myapplication.activity;

import android.support.design.widget.BottomSheetDialog;
import android.view.View;

import com.example.littleSpider.myapplication.R;
import com.example.littleSpider.myapplication.base.BaseActivity;
import com.example.littleSpider.myapplication.myInterfaces.MethodInTitle;
import com.example.littleSpider.myapplication.view.TitleView;
import com.weigan.loopview.LoopView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by EDZ on 2017/12/14.
 * <p>
 * 申请成为网点界面
 */

public class ApplyDotActivity extends BaseActivity implements MethodInTitle {

    @BindView(R.id.title_view)
    TitleView title_view;

    private BottomSheetDialog dialog;

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_applydot;
    }

    @Override
    protected void initView() {
        title_view.initMyTitle("申请成为网点", this);
        title_view.hideTitleTextImage();
    }

    @Override
    protected void initData() {

    }

    @OnClick(R.id.layout_regionselect)
    void dotClickk(View view) {
        switch (view.getId()) {
            //地区选择
            case R.id.layout_regionselect:
                openBottomRegionSelect();
                break;
        }
    }

    //地区选择弹窗
    private void openBottomRegionSelect() {
        dialog = new BottomSheetDialog(this);
        dialog.setContentView(R.layout.bottom_itemregionselect);

        List<String> items = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            items.add("所在地" + i);
        }

        LoopView loop_view_province = (LoopView) dialog.findViewById(R.id.loop_view_province);
        LoopView loop_view_city = (LoopView) dialog.findViewById(R.id.loop_view_city);
        LoopView loop_view_area = (LoopView) dialog.findViewById(R.id.loop_view_area);
        LoopView loop_view_town = (LoopView) dialog.findViewById(R.id.loop_view_town);

        loop_view_province.setNotLoop();
        loop_view_city.setNotLoop();
        loop_view_area.setNotLoop();
        loop_view_town.setNotLoop();

        loop_view_province.setItems(items);
        loop_view_city.setItems(items);
        loop_view_area.setItems(items);
        loop_view_town.setItems(items);

        loop_view_province.setInitPosition(0);
        loop_view_city.setInitPosition(0);
        loop_view_area.setInitPosition(0);
        loop_view_town.setInitPosition(0);

        loop_view_province.setTextSize(20);
        loop_view_city.setTextSize(20);
        loop_view_area.setTextSize(20);
        loop_view_town.setTextSize(20);

        dialog.show();


    }

    @Override
    public void setGoBack() {
        finish();
    }

    @Override
    public void onRightOne() {

    }

    @Override
    public void onRightTwo() {

    }

    @Override
    public void onTitleText() {

    }
}
